﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CAGFIP.Jogo;
using CAGFIP.Edicao;
using CAGFIP.Utils;

namespace CAGFIP.GUI
{
    public class MenuInicial : Panel
    {

        public MenuInicial()
        {
            this.Dock = DockStyle.Fill;
            this.Location = new System.Drawing.Point(0,0);
            initComponents();
        }

        private void initComponents()
        {
            visualizarRanking = new Button();
            visualizarRanking.Location = new System.Drawing.Point(89, 492);
            visualizarRanking.Size = new System.Drawing.Size(130, 25);
            visualizarRanking.TabIndex = 0;
            visualizarRanking.Text = "Visualizar Ranking";
            visualizarRanking.UseVisualStyleBackColor = true;
            visualizarRanking.Click += new EventHandler(visualizarRanking_Click);

            iniciarJogo = new Button();
            iniciarJogo.Location = new System.Drawing.Point(334, 492);
            iniciarJogo.Size = new System.Drawing.Size(130, 25);
            iniciarJogo.TabIndex = 1;
            iniciarJogo.Text = "Novo Jogo";
            iniciarJogo.UseVisualStyleBackColor = true;
            iniciarJogo.Click += new EventHandler(iniciarJogo_Click);

            manipularPergunta = new Button();
            manipularPergunta.Location = new System.Drawing.Point(586, 492);
            manipularPergunta.Size = new System.Drawing.Size(130, 25);
            manipularPergunta.TabIndex = 2;
            manipularPergunta.Text = "Manipular Perguntas";
            manipularPergunta.UseVisualStyleBackColor = true;
            manipularPergunta.Click += new EventHandler(manipularPergunta_Click);

            this.Controls.Add(visualizarRanking);
            this.Controls.Add(iniciarJogo);
            this.Controls.Add(manipularPergunta);
        }

        void manipularPergunta_Click(object sender, EventArgs e)
        {
            ControladorGUI.Instance.ExibirAutenticacao();
        }

        void iniciarJogo_Click(object sender, EventArgs e)
        {
            try
            {
                ControladorGUI.Instance.ExibirConfiguracao();
            }
            catch/*(Exception exception)*/
            {
                ControladorGUI.Instance.ExibirMensagemErro(Erros.SemAssuntosCadastrados);
            }
        }

        void visualizarRanking_Click(object sender, EventArgs e)
        {
            ControladorGUI.Instance.ExibirRanking();
        }


        private Button iniciarJogo;
        private Button manipularPergunta;
        private Button visualizarRanking;
    }
}
